﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SqlBuilder
{
    public static class Configuration
    {
        static Configuration()
        {        
            singletonsAutoSerialize = new AutoSerialize<Dictionary<string, string>>("singletons");
            if (singletonsAutoSerialize.Value == null || singletonsAutoSerialize.Value.Count==0)
            {
                singletonsAutoSerialize.Value = new Dictionary<string, string>
                        {
                            { typeof(List<TableStructure>).ToString(),"tables" }
                        };
                singletonsAutoSerialize.Save();
            }

        }
        public static void Save()
        {
            singletonsAutoSerialize.Save();
        }

        private static AutoSerialize<Dictionary<string, string>> singletonsAutoSerialize;

        public static Dictionary<string, string> Singletons => singletonsAutoSerialize.Value!;

        private static AutoSerialize<Dictionary<string, string>> commentsAutoSerialize = new AutoSerialize<Dictionary<string, string>>("commentsMapping");

        public static Dictionary<string, string> CommentsDic => commentsAutoSerialize.Value!;

        private static AutoSerialize<Settings> SettingAutoSerialize  = new AutoSerialize<Settings>("settings");

        public static Settings Settings => SettingAutoSerialize.Value!;

    }
}
